package com.woohua.thread.create;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/***
 * @title FeatureDemo
 * @description： 实现 Callable 接口 ，有返回值
 * @author woo hua
 * @version 1.0.0
 * @create 2023/3/9 11:36
 **/
public class FutureDemo {

    public static void main(String[] args) {
        FutureTask futureTask = new FutureTask(new CallableWorker());
        new Thread(futureTask).start();

        try {
            Object o = futureTask.get();
            System.out.println(o);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }


}
